export function getStyle(element, property) {
  if (!element) {
    console.error('getStyle => element is empty; [empty]: ', element)
    return undefined
  }
  return window.getComputedStyle
    ? window.getComputedStyle(element, null).getPropertyValue(property)
    : element.style[
        property.replace(/-([a-z])/g, function (g) {
          return g[1].toUpperCase()
        })
      ]
}

export function getAdminMainBgColor() {
  return getStyle(
    document.getElementsByClassName('admin-layout-main')[0],
    'background-color'
  )
}

/**
 * 含最大值，含最小值
 */
export function getRandomIntInclusive(min = 1, max = 100000) {
  min = Math.ceil(min)
  max = Math.floor(max)
  return Math.floor(Math.random() * (max - min + 1)) + min
}
